package com.godfrey.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.godfrey.entity.Account;
import com.godfrey.mapper.AccountMapper;
import com.godfrey.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author godfrey
 * @since 2021-01-02
 */
@Service
public class AccountServiceImpl implements AccountService {

    private final AccountMapper accountMapper;

    @Autowired
    public AccountServiceImpl(AccountMapper accountMapper) {
        this.accountMapper = accountMapper;
    }

    @Override
    public Account findByUserName(String username) {
        QueryWrapper<Account> wrapper = new QueryWrapper<>();
        wrapper.eq("username", username);
        return accountMapper.selectOne(wrapper);
    }
}
